let http = require('http');
let url = require('url');

http.createServer(function(req,res){
    if (req.url == ' /favicon.ico') return;
    res.writeHead('200',{'Content-type':'text/html;charset=UTF-8'} 
    )
    let urlObj = url.parse(req.url,true);
    if(urlObj.pathname == '/login'){
        res.end(`登录名:${urlObj.query.username}`)
    }else if(urlObj.pathname == '/register'){
        res.end(`注册信息:${urlObj.query.username}`)
    } else{
        res.write( '请求不存在');
        res.end();
    } 
}).listen(3000,'127.0.0.1')